package JavaTest.VarParameter;

public class VarParameter {
    public static void main(String[] args) {
//        int[] arr = {1,2,3};
        Test test = new Test();
//        test.fun1(arr);
        String a = test.shoeScore("a", 100, 100);
        System.out.println(a);
    }
}
class Test{
    public void fun1(int... nums){

    }

    public void fun2(double num,int... nums){

    }

    /**
     * 1. 返回姓名和两门课成绩总
     * 2. 返回姓名和三门课成绩总
     * 3. 返回姓名和五门课成绩总
     * 将这三种方法封装成一个可变参数的方法
     */
    public String shoeScore(String name , int... score){
        int totalScore = 0;
        for (int temp :
                score) {
            totalScore += temp;
        }
        return "姓名："+name+" "+score.length+"门总分:"+totalScore;
    }
}